/*
 * @lc app=leetcode.cn id=101 lang=c
 * @lcpr version=30204
 *
 * [101] 对称二叉树
 */

// @lcpr-template-start

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

// @lcpr-template-end
// @lc code=start
/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     struct TreeNode *left;
 *     struct TreeNode *right;
 * };
 */

void ifSymmetric(struct TreeNode *rootL, struct TreeNode *rootR, bool *ret)
{
    if ((rootL == NULL) && (rootR == NULL))
        return;
    else if (rootL != NULL && rootR != NULL)
    {
        ifSymmetric(rootL->left, rootR->right, ret);
        ifSymmetric(rootL->right, rootR->left, ret);
        if (rootL->val != rootR->val)
        {
            *ret = false;
        }
    }
    else
    {
        *ret = false;
    }
}
bool isSymmetric(struct TreeNode *root)
{
    bool ret = true;
    ifSymmetric(root->left, root->right, &ret);
    if (ret)
        printf("true");
    else
        printf("false");
    return ret;
}
// @lc code=end

/*
// @lcpr case=start
// [1,2,2,3,4,4,3]\n
// @lcpr case=end

// @lcpr case=start
// [1,2,2,null,3,null,3]\n
// @lcpr case=end

 */
